Errata for the Fourth Printing (first edition)

`book.html | TOC | CD-ROM | References | Errata | Tutorial Trail Map`

# Errata for the Fourth Printing (first edition)

We made a lot of minor changes to the fourth printing of The Java Tutorial to fix various errors and ommissions. The changes effected over 100 pages and are too numerous and (for the most part) too trivial to list individually. So, instead we summarize:

- Now that they're born, we added a picture of the babies to the preface and we changed the text accordingly. Here it is. Cosmo is on the left and Sophia is on the right.

- Changed the spelling of "MacOS" to "Mac OS" everywhere.

- Fixed various typographical, grammatical, spelling, and production errors. The majority of the changes fall into this category.

- Page 48 previously stated that Unicode allows for the codification of 34,168 characters. But of course this can't be right because Unicode is 16-bit which provides space for 65,536 characters. We changed this to say is that 34,168 are currently assigned.

- We fixed some errors in the content of the Threads of Control lesson.

  1. When putting a thread to sleep, you use the `sleep()` method. `sleep()` is a class method (not an instance method). In printings prior to the fourth, the examples in the threads lesson called the `sleep()` method from a thread instance like this:

     >     myThread.sleep();

     This incorrectly implies that the instruction is putting `myThread` to sleep when in fact it is putting the current thread to sleep. The examples should, in fact, call the `sleep()` method from the class like this:

     >     Thread.sleep();

     The examples and text have been corrected.

  2. In printings prior to the fourth, the producer/consumer example in the threads lesson used the `notify()` method to notify waiting threads that a certain condition had been met. While this worked for the particular example because there is only one producer and one consumer, this solution does not scale to work with multiple producers and multiple consumers. A programmer who is not going to analyze a multithreaded program sufficiently carefully is better off using `notifyAll()`. The examples and text have been corrected.

  3. In the section that talks about the `notify()` and `wait()` methods, we claimed that those methods could only be called within a synchronized block. The fourth printing now states: Note: The `notifyAll()` and `wait()` methods can be invoked only by the thread that holds the lock.

`book.html | TOC | CD-ROM | References | Errata | Tutorial Trail Map`